package com.sunday.electric.base;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.View;

import com.sunday.common.event.EventBus;
import com.umeng.analytics.MobclickAgent;

import butterknife.ButterKnife;

/**
 * Created by Administrator on 2015/11/16.
 */
public class BaseFragment extends Fragment {
    protected Context mContext;
    protected Intent intent;
    protected String TAG = getClass().getSimpleName();
    protected View rootView;
    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mContext = getActivity();
    }
    public void onResume() {
        super.onResume();
        MobclickAgent.onPageStart(TAG); //统计页面
    }
    public void onPause() {
        super.onPause();
        MobclickAgent.onPageEnd(TAG);
    }
    @Override
    public void onDestroy() {
        super.onDestroy();
        ButterKnife.unbind(this);
        if(EventBus.getDefault().isRegistered(this)){
            EventBus.getDefault().unregister(this);//反注册EventBus
        }
    }
}
